import BScroll from 'better-scroll';//引入better-scroll
/**
 * 
 * @param {代表vue实例} that 
 * @param {横向滚动的容器} wrapper 
 * @param {横向滚动的内容区} content 
 * @param {滚动项的数目} num 
 * @param {滚动项的宽度 (单位是rem) } itemWidth 
 */
function betterScrollHorizontal(that,wrapper,content,num,itemWidth){
    //计算内容区的宽度,动态设置
    content.style.width = num * itemWidth + "rem";
    that.$nextTick(()=>{
        that.scroll= new BScroll(wrapper,{
                scrollX: true, //开启横向滚动
                scrollY: false, //关闭纵向滚动
                startX: 0,
                click: true
      });
    });
}
export {betterScrollHorizontal}